package com.heima.zrh;

public class demo02 {
    public static void main(String[] args) {
        int sum = getSum(100, 1);
        System.out.println(sum);
    }

    public static int getSum(int n, int m) {
        int sum = 0;
        if (n < m) {
            for (int i = n; i <= m; i++) {
                if (i % 2 == 0) {
                    sum += i;
                }
            }
        } else {
            for (int i = m; i <= n; i++) {
                if (i % 2 == 0) {
                    sum += i;
                }
            }
        }
        return sum;
    }
}